//73 normal
/**
 *
 * @param {number[][]} matrix
 */
function setZero(matrix) {
  const rowSet = new Set();
  const columnSet = new Set();
  for (let i = 0; i < matrix.length; i++) {
    for (let j = 0; j < matrix[i].length; j++) {
      if (matrix[i][j] === 0) {
        rowSet.add(i);
        columnSet.add(j);
      }
    }
  }
  rowSet.forEach((i) => {
    for (let j = 0; j < matrix[i].length; j++) {
      matrix[i][j] = 0;
    }
  });
  columnSet.forEach((j) => {
    for (let i = 0; i < matrix.length; i++) {
      matrix[i][j] = 0;
    }
  });
}
let matrix = [
  [0, 1, 2, 0],
  [3, 4, 5, 2],
  [1, 3, 1, 5],
];
setZero(matrix);
console.log(matrix);
console.log(1);
